package bairui.international.console.web.controller.barter.product;

import com.lianjing.sh.spring.web.controller.enhance.module.Module;
import com.lianjing.sh.spring.web.controller.enhance.module.ModuleHead;

/**
 *
 * Module_Edit
 *
 */
class Module_Edit{

	
	public Module module(
		bairui.international.model.domain.jpa.TB_Product bean
		, 
		C_Barter_Product_Edit_Edit.Edit.Operate c_Barter_Product_Edit_Edit_Edit_Operate
				, 
		java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> productCategory
		,com.lianjing.sh.spring.web.controller.enhance.input.InputModelContextMethodInfoEditor ... editors
		
	){
		return moduleTemplate(
				bean
				, 
				c_Barter_Product_Edit_Edit_Edit_Operate
						, 
				productCategory
				,editors
			);
	}
	
	public Module module(
		java.util.List<bairui.international.model.domain.jpa.TB_Product> bean
		, 
		C_Barter_Product_Edit_Edit.Edit.Operate c_Barter_Product_Edit_Edit_Edit_Operate
				, 
		java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> productCategory
		,com.lianjing.sh.spring.web.controller.enhance.input.InputModelContextMethodInfoEditor ... editors
		
	){
		return moduleTemplate(
				bean
				, 
				c_Barter_Product_Edit_Edit_Edit_Operate
						, 
				productCategory
				,editors
			);
	}
	
	
	/**
	 * 编辑模块
	 */
	private Module moduleTemplate(
		Object bean
		, 
		C_Barter_Product_Edit_Edit.Edit.Operate c_Barter_Product_Edit_Edit_Edit_Operate
				, 
		java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> productCategory
		,com.lianjing.sh.spring.web.controller.enhance.input.InputModelContextMethodInfoEditor ... editors
		
	){
		return
			new Module(
					new ModuleHead("编辑")
					, 
					new com.lianjing.sh.spring.web.controller.enhance.module.body.EditModuleBody(
							bean, 
							Model.class,
							c_Barter_Product_Edit_Edit_Edit_Operate, 
							Relation.relations(
									productCategory
								)
							,editors
						)
				);
	}
	
	/**
	 * 输入模型
	 */
	static public class Models {
		private @lombok.Getter @lombok.Setter java.util.List<Model> models = new java.util.ArrayList<>();
	}
	
	@org.springframework.stereotype.Component("bairui.international.console.web.controller.barter.product.Module_Edit$Model")
	
	static public class Model
	
	 extends bairui.international.model.domain.jpa.TB_Product
	
	 implements 
	
		com.lianjing.sh.spring.web.controller.enhance.input.InputModelable
	
	{
	
	
	
		/**
	
		 * 默认构造函数
	
		 */
	
		public Model(){}
	
	
	
		/**
	
		 * 构造函数
	
		 */
	
		public Model(
	
			bairui.international.model.domain.jpa.TB_Product bean
	
		){
	
			if(null != bean){
	
				this.setName(bean.getName());
	
				this.setNumber(bean.getNumber());
	
				this.setScore(bean.getScore());
	
				this.setOrderValue(bean.getOrderValue());
	
				this.setProductCategory(bean.getProductCategory());
	
				this.setComment(bean.getComment());
	
				this.setImgUrl(bean.getImgUrl());
	
			}
	
		}
	
		
	
	
	
		@com.lianjing.sh.model.common.annotation.Comment("名称")
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(1001)
	
		@org.hibernate.validator.constraints.NotBlank
	
		@javax.validation.constraints.Size(min=0, max=255)
	
		@Override
	
		public String getName() {
	
			return (String)super.getName();
	
		}
	
		
	
	
	
		@com.lianjing.sh.model.common.annotation.Comment("代码")
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(2001)
	
		@org.hibernate.validator.constraints.NotBlank
	
		@javax.validation.constraints.Size(min=0, max=32)
	
		@Override
	
		public String getNumber() {
	
			return (String)super.getNumber();
	
		}
	
		
	
	
	
		@com.lianjing.sh.model.common.annotation.Comment("积分")
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(3001)
	
		@javax.validation.constraints.NotNull
	
		@javax.validation.constraints.Max(Long.MAX_VALUE)
	
		@javax.validation.constraints.Min(Long.MIN_VALUE)
	
		@Override
	
		public Double getScore() {
	
			return (Double)super.getScore();
	
		}
	
		
	
	
	
		@com.lianjing.sh.model.common.annotation.Comment("排序")
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(4001)
	
		@javax.validation.constraints.NotNull
	
		@javax.validation.constraints.Max(Integer.MAX_VALUE)
	
		@javax.validation.constraints.Min(Integer.MIN_VALUE)
	
		@Override
	
		public Integer getOrderValue() {
	
			return (Integer)super.getOrderValue();
	
		}
	
		
	
	
	
		@com.lianjing.sh.model.common.annotation.Comment("产品分类")
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(5001)
	
		@javax.validation.constraints.NotNull
	
		@Override
	
		public bairui.international.model.domain.jpa.TB_ProductCategory getProductCategory() {
	
			return (bairui.international.model.domain.jpa.TB_ProductCategory)super.getProductCategory();
	
		}
	
		
	
	
	
		@com.lianjing.sh.model.common.annotation.Comment("产品描述")
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(6001)
	
		@javax.validation.constraints.Size(min=0, max=500)
	
		@Override
	
		public String getComment() {
	
			return (String)super.getComment();
	
		}
	
		
	
	
	
	
	
		/**
	
		 * 文件属性
	
		 */
	
		private org.springframework.web.multipart.MultipartFile imgUrlFile;
	
		
	
		/**
	
		 * 文件方法
	
		 */
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(7001)
	
		@com.lianjing.sh.model.common.annotation.Comment("图片")
	
		
	
		@com.lianjing.sh.validate.file.FileType(extension={"bmp","png","jpg","jpeg"})
	
		@com.lianjing.sh.validate.file.Image
	
		public org.springframework.web.multipart.MultipartFile getImgUrlFile() {
	
			return this.imgUrlFile;
	
		}
	
		public void setImgUrlFile(org.springframework.web.multipart.MultipartFile imgUrlFile) {
	
			this.imgUrlFile = imgUrlFile;
	
		}
	
	
	
		/**
	
		 * 非继承属性
	
		 */
	
	
	
		/**
	
		 * 得到输入属性
	
		 */
	
		/** 得到名称 */
	
		public String gainName() {
	
			return this.getName();
	
		}
	
		/** 得到代码 */
	
		public String gainNumber() {
	
			return this.getNumber();
	
		}
	
		/** 得到积分 */
	
		public Double gainScore() {
	
			return this.getScore();
	
		}
	
		/** 得到排序 */
	
		public Integer gainOrderValue() {
	
			return this.getOrderValue();
	
		}
	
		/** 得到产品分类 */
	
		public bairui.international.model.domain.jpa.TB_ProductCategory gainProductCategory() {
	
			return this.getProductCategory();
	
		}
	
		/** 得到产品描述 */
	
		public String gainComment() {
	
			return this.getComment();
	
		}
	
		/** 得到 */
	
		public org.springframework.web.multipart.MultipartFile gainImgUrlFile() {
	
			return this.getImgUrlFile();
	
		}
	
	
	
		/**
	
		 * 转换到表单数据格式
	
		 */
	
		public java.util.Map<String, String> toFormData() throws com.sh_lianjing.serialize.json.jackson.exception.JsonException{
	
			return com.lianjing.sh.web.common.util.Util_Form.beanToFormDataFormat(this);
	
		}
	
	
	
	}
	
	
	
	static public class Relation
	{
		public static java.util.Map<String, java.util.List<?>> relations(
			java.util.List<bairui.international.model.domain.jpa.TB_ProductCategory> productCategory
		){
			java.util.Map<String, java.util.List<?>> map = new java.util.HashMap<>();
				map.put(bairui.international.model.domain.jpa.FTB_Product.productCategory.Name, productCategory);
			return map;
		}
	}
	
	
	
	/**
	 * 输出模型
	 */
	

}
